//
//  Kong.m
//  ZhuKuang
//
//  Created by jayce on 17/7/14.
//  Copyright © 2017年 jjkj. All rights reserved.
//

#import "YZOilTankView.h"

@interface YZOilTankView()
@property (weak, nonatomic) IBOutlet UILabel *typeLabel;
@property (weak, nonatomic) IBOutlet UILabel *percentageLabel;
@property (weak, nonatomic) IBOutlet UIImageView *blueImageView;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *blueImageTop;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *percentageBottom;

@end
@implementation YZOilTankView

#pragma mark - 设置数据源
- (void)setYzOilTankModel:(YZOilTankModel *)yzOilTankModel{
    
    _yzOilTankModel = yzOilTankModel;
    self.typeLabel.text = yzOilTankModel.iolContain;
    CGFloat percentage = [yzOilTankModel.ioltotal floatValue];//百分比
    self.percentageLabel.text = [NSString stringWithFormat:@"%.2f%%",percentage];
    
    if ((percentage*0.01) > 0.01) {
        //油柱高度
        _blueImageTop.constant = -156*percentage*0.01;
        //百分比位置
        if(percentage>70){
            _percentageBottom.constant = 78;
        }else{
            _percentageBottom.constant = 156*percentage*0.01;
        }
    }
}
@end
